<?php
include_once __DIR__.'/../config/env_config.php';
include_once __DIR__.'/../vendor/autoload.php';
include_once __DIR__.'/../lib/Helper.php';

$ticketsDataFile = __DIR__."/../data/tickets.json";
$tickets = json_decode(file_get_contents($ticketsDataFile), true);
$result = Helper::emailTickets(array_filter($tickets, function($ticket) {
    $date = explode('-', $ticket['open_date']);
    $date = $date[2].'-'.$date[0].'-'.$date[1];
    return in_array(Helper::ticketLevel($ticket), array('danger', 'warn')) 
        && strtotime($date) > time() - 2 * 30 * 24 * 60 * 60;
}));
var_dump($result);